Skip to content

Allow opening a legacy (json) db, and example of migration #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2025
Merged

Conversation

BoD
Copy link
Collaborator

@BoD BoD commented Dec 20, 2024

When opening a db which has version 1, we assume it might be using the legacy (json) format. When that happens, the old records table is dropped, and the new blobs one is created.

This of course deletes all cached data (we must update the doc to make this clear).

That is a simple approach appropriate for apps that treat the cache as "only a cache", that can be lost without issues (other than needing to reload data from the network).

As an alternative, the test shows an example of migrating by copying records from a legacy store to the new one. Maybe this could be an API but since it is only a few lines long, and may need some app-specific logic (e.g. copy only certain important records, rather than all of them), I'll leave it as an example for now.

@BoD BoD requested a review from martinbonnin as a code owner December 20, 2024 17:36
@BoD BoD merged commit cb445f7 into main Jan 27, 2025
2 checks passed
@BoD BoD deleted the migration branch January 27, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant